<%@ page import="ar.com.hakasoft.utils.DateUtil" %>
<%@ page import="ar.com.hakasoft.utils.NumberUtil" %>

<html>
<head>
<meta name="layout" content="mainApp" />
<g:javascript library="jquery"  /> 
<g:javascript library="facturacion" />
<g:javascript library="egreso" />
</head>
<body>
    <g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${egresoInstance}">
    <div class="errors">
        <g:renderErrors bean="${egresoInstance}" as="list" />
    </div>
	</g:hasErrors>
	    <g:hasErrors bean="${egresoInstance}">
    <div class="errors">
        <g:renderErrors bean="${egresoInstance}" as="list" />
    </div>
	</g:hasErrors>
 	<g:uploadForm action="show" name="form" controller="egreso" >
 	
 		<g:hiddenField name="fechaHidden" value="${listadoEgresos?.first()?.fecha}" />
 	
	    <div class="dialog" align="center">
	        <table>
	            <tbody>
	                <tr class="prop">
	                    <td valign="top" class="name">
	                        <label>Fecha</label>
	                    </td>
  	                    <td valign="top" class="value">
	        				<label><b><g:formatDate format="dd/MM/yyyy" date="${listadoEgresos?.first()?.fecha}"/></b></label>
                        </td>
	                </tr>
  	                <tr class="prop">
	                    <td valign="top" class="name">
	                        <label>Total</label>
	                    </td>
  	                    <td valign="top" class="value">
	        				<label><b>$ ${NumberUtil.setearDecimales(listadoEgresos?.total.sum(),2) }</b></label>
                        </td>
	                </tr>
	            
	            </tbody>
	        </table>
	    </div>
	    
	    <br><br>
	    
	    <div id="tablaEgresos"><g:render template="/templates/tablaItemsEgresos" model="['listadoEgresos':listadoEgresos]"/></div>
	    
	    <br><br>
		<div align="center">
<%--		    	<g:actionSubmit name="Nuevo" value="Nuevo" action="index"  />--%>
		    	<button class="imprimir" onclick="window.open('${ g.createLink(action: 'imprimir', params:['fecha': DateUtil.toString(listadoEgresos?.first()?.fecha)] ) }', 'Imprimir','status=1,toolbar=1'); return false" name="Imprimir" value="Imprimir" action="imprimir" >Imprimir</button>
<%--		    	<g:actionSubmit name="Editar" value="Editar" action="editar"  />--%>
	    </div>
    
    	</g:uploadForm>
	    


</body>
</html>